#ifndef USECASEDBADAPTER_H
#define USECASEDBADAPTER_H

#include <adapterinterface.h>
#include <dynamicmodel.h>

class UseCaseDBAdapter : public QObject,
                         public UseCaseDBAdapterInterface
{
    Q_OBJECT
    Q_INTERFACES(PluginInterface UseCaseDBAdapterInterface)


public:
    UseCaseDBAdapter();

    QString name()const;
    QString description()const;

    bool connectToDatabase();
    QStringList loadModelList();
    bool addModel(const QString & name, DynamicModel * model);
    DynamicModel * loadModel(int modelID);

private:
    int addModelHead(const QString name, const QString & description);
    bool addModelItem(int modelID, ARSExecItem * item, int parentID);
    int addModelItemHead(ARSExecItem * item, const QMetaObject * currentMetaObject = 0);
    QString simpleVariant2String(QVariant value);
    QHash<QString, int> m_itemTypeHash;
};

#endif // USECASEDBADAPTER_H
